﻿// -----------------------------------------------------------------------
// <copyright file="RepositoryFactory.cs" company="Hewlett-Packard">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex3.Repository
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using FacebookWrapper.ObjectModel;

    /// <summary>
    /// The repository facroty - the abstract factory
    /// </summary>
    public class RepositoryFactory : IRepositoryFactory
    {
        public User LoggedinUser { get; set; }

        private RepositoryType SelectedRepository { get; set; }

        public RepositoryFactory()
        {
        }

        public RepositoryFactory(User i_LoggedinUser, RepositoryType i_repositoryType)
        {
            this.LoggedinUser = i_LoggedinUser;
            this.SelectedRepository = i_repositoryType;
        }

        public IFileRankRepository CreateFileRankRepository()
        {
            switch (this.SelectedRepository)
            {
                case RepositoryType.XML:
                {
                    return new XmlFactory(this.LoggedinUser).CreateNewFileRankRepository();
                }
            }

            return null;
        }

        public ICircleRepository CreateCircleRepository()
        {
            switch (this.SelectedRepository)
            {
                case RepositoryType.XML:
                    {
                        return new XmlFactory(this.LoggedinUser).CreateNewCircleRepository();
                    }
            }

            return null;
        }
    }
}
